package com.xd.demo.util;





import org.apache.commons.codec.binary.Base64;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class test1 {

    public static void transFile(String in,String out,String key) throws Exception{

        FileInputStream fis = new FileInputStream(in);
        FileOutputStream fos = new FileOutputStream(out);

//        Cipher cipher = Cipher.getInstance( "AES/CBC/PKCS5Padding" );
//        byte[] raw = key.getBytes("UTF-8");
//        IvParameterSpec iv = new IvParameterSpec(raw);
//        cipher.init( Cipher.DECRYPT_MODE, new SecretKeySpec( raw, "AES" ), iv );

        byte [] bytes = new byte[16];
        while (fis.read(bytes)!=-1){
            fos.write(Base64.decodeBase64(bytes));
        }
        fis.close();
        fos.close();
    }

    public static void main(String[] args) throws Exception {

        transFile("d:\\test.tar.gz","d:\\test3.tar.gz","9cdbb6fa5b67091e");

    }

}
